<html>
  <head>
    <script>
      if (window.testRunner) {
        testRunner.dumpAsText();
        testRunner.waitUntilDone();
      }

      function runTest()
      {
        window.frames[0].document.getElementById("textField").focus();

        if (window.eventSender) {
          var frame = document.getElementById("anIFrame");

          // center the mouse cursor (NOTE: 2px inset for scrollbars).
          var x = frame.offsetParent.offsetLeft + frame.contentDocument.body.clientWidth + 8;
          var y = frame.offsetParent.offsetTop + frame.offsetHeight / 2;

          // send mouse event to click iframe's scrollbar.
          eventSender.mouseMoveTo(x, y);
          eventSender.mouseDown();
          eventSender.mouseUp();
          finished();
        }
      }

      function finished()
      {
        var doc = window.frames[0].document;

        if (doc.hasFocus() && doc.activeElement.getAttribute("id") == "textField")
            document.getElementById('console').innerHTML = "PASS";
        else
            document.getElementById('console').innerHTML = "FAIL";

        if (window.testRunner)
          testRunner.notifyDone();
      }

    </script>
  </head>

  <body>
    <div id="console" style="left:50px;top:50px;width:200px;height:200px;position:absolute;">
      <iframe onload="runTest();" id="anIFrame" style="width:200px;height:200px;position:absolute;" src="resources/scrollable-iframe-with-input-field.html">
    </div>
</body>
</html>
